## -------------------------------------------------- #
## _readme.txt
## -------------------------------------------------- #

 Date: 2024-01-10

 Authors: David Samuels, Fernando Mello, Cesar Zucco

 Title: Partisan Stereotyping and Polarization in Brazil
 
Contact Information: 
   David Samuels <dsamuels@umn.edu>
   Fernando Mello <fernando.barros@uc3m.es>
   Cesar Zucco <cesar.zucco@fgv.br>
   	
 Copyright (c) 2021, under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
 For more information see: http://creativecommons.org/licenses/by-nc-sa/3.0/us/
 All rights reserved. 

## -------------------------------------------------- #


This file describes the contents of the replication archive used to conduct the analyses in the main text and appendix. 


## -------------------------------------------------- #
## install R and necessary packages for analysis
## -------------------------------------------------- #

install R 

install packages if necessary. 

Save the replication files locally into a dedicated new directory. 

open the .R file using RStudio or any text or source code editor 

set the working directory to the folder containing the data files 
	the set working directory command in R is setwd()
	to set the path type into R: setwd("PATH_NAME"), where PATH_NAME is the path to the main folder
	type ?setwd for help documentation 
	alternatively, create a new R project housed in the dedicated folder

Check the R working directory is available via the getwd() function in R.

Run the replication file. Figure and tables will output to the screen. 
Alternatively, if using RStudio, you can compile a report with all the output  


## -------------------------------------------------- #
## hardware and software 
## -------------------------------------------------- #

The last version of R and Mac OS-X at the time the paper was published are:

	R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
	Copyright (C) 2020 The R Foundation for Statistical Computing
	Platform: x86_64-apple-darwin17.0  


attached base packages:[1] grid      stats     graphics  grDevices utils     datasets  methods   base     other attached packages: [1] matrixStats_1.2.0 mice_3.14.0       reshape2_1.4.4    texreg_1.38.6     [5] ltm_1.2-0         polycor_0.8-1     msm_1.6.9         MASS_7.3-56       [9] xtable_1.8-4      plotrix_3.8-2     car_3.0-13        carData_3.0-5    [13] estimatr_0.30.6   haven_2.5.0       foreign_0.8-82    pewmethods_1.0   [17] remotes_2.4.2     knitr_1.39        pander_0.6.5      srvyr_1.1.1      [21] survey_4.1-1      survival_3.3-1    Matrix_1.4-1      forcats_0.5.1    [25] stringr_1.4.0     dplyr_1.1.3       purrr_1.0.2       readr_2.1.2      [29] tidyr_1.2.0       tibble_3.2.1      ggplot2_3.3.6     tidyverse_1.3.1  loaded via a namespace (and not attached): [1] fs_1.5.2         lubridate_1.8.0  httr_1.4.6       tools_4.2.0      backports_1.4.1  [6] utf8_1.2.2       R6_2.5.1         DBI_1.1.2        colorspace_2.0-3 withr_2.5.0     [11] tidyselect_1.2.0 emmeans_1.7.4-1  compiler_4.2.0   cli_3.6.1        rvest_1.0.3     [16] expm_0.999-6     xml2_1.3.3       sandwich_3.0-2   scales_1.2.0     mvtnorm_1.1-3   [21] digest_0.6.29    rmarkdown_2.14   htmltools_0.5.2  pkgconfig_2.0.3  fastmap_1.1.0   [26] highr_0.9        dbplyr_2.1.1     rlang_1.1.1      readxl_1.4.0     rstudioapi_0.13 [31] generics_0.1.2   zoo_1.8-10       jsonlite_1.8.0   zip_2.2.0        magrittr_2.0.3  [36] Formula_1.2-4    Rcpp_1.0.9       munsell_0.5.0    fansi_1.0.3      abind_1.4-5     [41] lifecycle_1.0.3  stringi_1.7.6    multcomp_1.4-19  plyr_1.8.7       parallel_4.2.0  [46] crayon_1.5.1     lattice_0.20-45  splines_4.2.0    hms_1.1.1        pillar_1.9.0    [51] ranger_0.13.1    estimability_1.3 admisc_0.29      codetools_0.2-18 reprex_2.0.1    [56] glue_1.6.2       evaluate_0.15    mitools_2.4      modelr_0.1.8     vctrs_0.6.4     [61] tzdb_0.4.0       cellranger_1.1.0 gtable_0.3.0     assertthat_0.2.1 xfun_0.31       [66] openxlsx_4.2.5   broom_0.8.0      coda_0.19-4      TH.data_1.1-1    ellipsis_0.3.2  


## -------------------------------------------------- #
# file description
## -------------------------------------------------- #

_readme.txt --- This file
 
codebook.pdf --- Codebook describing all variables in the dataset (will be available shortly) 

replication_laps.html -- html report with all output generated by running the code in RStudio

replication_laps.R -- Code to replicate all tables and figures in the paper and appendix, with two exceptions of text-only tables, as follows:
			Figure 1 - line 300			Figure 2 - line 382			Figure 3 - line 448			Figure 4 - line 541			Figure 5 - line 580			Figure B1 - line 258			Figure C1 - line 271			Figure D1 - line 499			Table 1 - Not replicated (text only)			Table 2 - Not replicated (text only)			Table 3 - line 720			Table 4 - line 760			Table 5 - line 869			Table 6 - line 944			Table D1  - line 1049

replication_laps.rds -- data file containing the dataset; see codebook.pdf for details. 

## -------------------------------------------------- #
## end of file
## -------------------------------------------------- #

